package com.hanwei.uap.common.enums.sstn;

import com.hanwei.uap.common.enums.MsgType;

import java.util.HashMap;
import java.util.Map;

public enum FrameType {
    BootStrapFrame(0x0002, MsgType.BOOT.name()), UploadStatusFrame(0x0102, MsgType.STATUS.name()),
    UploadDataFrame(0x0122, MsgType.DATA.name()),ControlCommandReplyFrame(0x0111, MsgType.REPLY.name()),
    UploadControlReadResponseFrame(0x0010, MsgType.PARAM.name()),UploadControlWriteReplyFrame(0x0011, MsgType.REPLY.name()),
    NetParaReadResponseFrame(0x0020, MsgType.PARAM.name()),NetParaWriteReplyFrame(0x0021, MsgType.REPLY.name()),
    SensorCollectReadResponseFrame(0x0040, MsgType.PARAM.name()),SensorCollectWriteReplyFrame(0x0041, MsgType.REPLY.name()),
    SensorSetReadResponseFrame(0x0050, MsgType.PARAM.name()),SensorSetWriteReplyFrame(0x0051, MsgType.REPLY.name()),
    ScreenControlReadResponseFrame(0x0060, MsgType.PARAM.name()),ScreenControlWriteReplyFrame(0x0061, MsgType.REPLY.name());

    FrameType(int value,String msgType) {
        this.value = value;
        this.msgType = msgType;
    }

    private int value;
    private String msgType;

    public int getValue() {
        return value;
    }

    public String getMsgType() {
        return msgType;
    }

    private static final Map<Integer, FrameType> map = new HashMap<Integer, FrameType>();

    static {
        for (FrameType p : FrameType.values())
            map.put(p.value, p);
    }

    public static FrameType getFrameTypeByValue(int value) {
        return map.get(value);
    }
}
